本文主要说Android 开发常见错误及分析解决

1.android.content.res.Resources$NotFoundException: Resource ID #0x0

  • 错误原因:系统找不到资源ID.
  • 常见错误是:
  • TextView中setText(value) 方法中使用了int类型的值,系统误以为是对应的R文件中的资源文件,结果找不到而报错.
  • 样式文件更新 找不到对应的属性 例如:style中的界面theme 的item name=alertDialogStyle 之前版本是好的 更新到新的版本 需要改成 name= android:alertDilogTheme

2. 打包提示这个错误。Error:A problem was found with the configuration of task ‘:app:packageRelease’

  • 错误原因:shrinkResources true 表示打包时删除无用的资源文件

  • 解决方法:shrinkResources false

3. fatal: refusing to merge unrelated histories

  • 错误原因:默认拒绝合并没有关系的历史记录
  • 处理方法:强制允许合并,使用如下代码
    1
    git pull origin branchname --allow-unrelated-histories